package com.match.pattern.singleton;

import com.match.pattern.singleton.model.SingletonFive;
import com.match.pattern.singleton.model.SingletonFour;
import com.match.pattern.singleton.model.SingletonOne;
import com.match.pattern.singleton.model.SingletonThree;
import com.match.pattern.singleton.model.SingletonTwo;

public class SingletonTest extends Thread{
	public SingletonTest() {
	}
	public SingletonTest(String name) {  
        super(name);  
    }  
	public static void main(String[] args) {
//		SingletonOne singleton=SingletonOne.getInstance();
//		SingletonTwo singletonTwo=SingletonTwo.getInstance();
//		SingletonThree singletonThree=SingletonThree.getInstance();
//		SingletonFour singletonFour=SingletonFour.getInstance();
//		SingletonFive singletonFive=null;
//		for(int i=0;i<10;i++ )
//		{
//			SingletonFive singletonFive=SingletonFive.getInstance();
//			singletonFive.haha();
//		}
  
		Thread t1 = new SingletonTest("A");  
        Thread t2 = new SingletonTest("B");  
        t1.start();  
        t2.start();  
		
	}
	/* (non-Javadoc)
	 * @see java.lang.Thread#run()
	 */
	@Override
	public void run() {
		String aString="";
		SingletonFive singletonFive=null;
		for(int i=0;i<1500;i++ )
		{
			singletonFive=SingletonFive.getInstance();
			aString+=this.getName();
		}
		singletonFive.haha(aString);
	}

}
